#!/usr/bin/env python
#encoding=utf-8


from wx import *
import ctypes
import sys
class TagAddPanel(Panel):
    def __init__(self, parent, id):
        Panel.__init__(self, parent, id, style = BORDER_SUNKEN)
      
        self.tagInput = TextCtrl(self, -1, '', style = TE_LEFT)
        self.addButton = Button(self,9,"Add To Tag Folder")
        sizer = BoxSizer(HORIZONTAL)
        sizer.Add(self.tagInput,0,wx.EXPAND,200)
        sizer.Add(self.addButton,1,wx.EXPAND)
        self.SetSizer(sizer)

        self.Bind(EVT_BUTTON,self.Onclick_addButton,self.addButton)

    def Onclick_addButton(self, event):
        tag = self.tagInput.GetValue()
        #call the dll to add tag folder
        dll = ctypes.CDLL("../../out/client_stub.dll")
        dll.AddTagA(str(tag));
    
class TagAddFrame(Frame):
    def __init__(self, parent, id, title):
        wx.Frame.__init__(self, parent, id, title, size=(300, 60))
        
        panel = TagAddPanel(self,-1)
        hbox = wx.BoxSizer()
        hbox.Add(panel,-1,wx.EXPAND)

        self.SetSizer(hbox)
        self.Centre()
        self.Show(True)

def main():
    app = wx.App()
    TagAddFrame(None,-1,'Add File To Tag Folder')
    app.MainLoop()

#if __name__ == "__main__":
sys.exit(main())
